package com.rs.game.player.dialogues.impl;

import com.rs.game.player.dialogues.Dialogue;

public class HousePortal extends Dialogue {

	@Override
	public void start() {
		sendOptionsDialogue("What would you like to do?",
				"Go to your house.", "Go to your house (Building mode).", "Go to a friend's house.", "Never mind.");
	}

	@Override
	public void run(int interfaceId, int componentId) {
		if (stage == -1) {
			if (componentId == OPTION_1) {
				if (player.hasHouse) {
					player.getHouse().setBuildMode(false);
					player.getHouse().enterMyHouse();
					end();
				} else {
					player.getDialogueManager().startDialogue("SimpleMessage", "You must purchase a property in order to do this, You can buy a property at the Estate Agent.");
				}
			} else if (componentId == OPTION_2) {
				if (player.hasHouse) {
					player.getHouse().setBuildMode(true);
					player.getHouse().enterMyHouse();
					end();
				} else {
					player.getDialogueManager().startDialogue("SimpleMessage", "You must purchase a property in order to do this, You can buy a property at the Estate Agent.");
				}
			} else if (componentId == OPTION_3) {
				if (player.hasHouse) {
					player.getInterfaceManager().closeChatBoxInterface();
					player.getTemporaryAttributes().put("teleto_house", true);
					player.getPackets().sendInputNameScript("Enter a players name.");
				} else {
					player.getDialogueManager().startDialogue("SimpleMessage", "You must purchase a property in order to do this, You can buy a property at the Estate Agent.");

				}
			} else if (componentId == OPTION_4) {
				end();
			} 
		} else if (stage == 0) {
			end();
		}
		//end();
	}

	@Override
	public void finish() {

	}

}
